export const yearOptions = [
  {
    value: '2025',
    label: '2025',
  },
  {
    value: '2024',
    label: '2024',
  },
  {
    value: '2023',
    label: '2023',
  },
  {
    value: '2022',
    label: '2022',
  },
  {
    value: '2021',
    label: '2021',
  },
]

export const dealSecondColumnData = (item,dynamicData) =>{
  let children = []
  // if(item.optionsVals && item.optionsVals.length>0) {
    // 有选中的项目            
    item.optionsVals.forEach((val,ind2)=>{
      const child = item.options.find((ele) => ele.name == val);          
      const currField = item.data.nameLocal + child.code 
      let obj = {
        label: child.name,
        id: item.id || "",
        // id: currField,
        Field: currField, // 没有该字段时 ，拼接唯一字段
        childFlag: false
      }
      dynamicData[currField] = child.name

      // 年 选项处理为 三级标题
      // if(item.data.isGroupbyYear == 1){
        if(item.yearVals && item.yearVals.length>0){
          obj.childFlag = true
          obj.children = dealYear(item,dynamicData)
        }         
      // }
      children.push(obj)
    })
    // childObj.children = children
  // } 
  // else{
  //   // 默认全部展示             
  //   item.options.forEach((child,ind2)=>{
  //     const currField = item.data.nameLocal + child.code
  //     let obj = {
  //       label: child.name,
  //       id: item.id || "",
  //       // id: currField,
  //       Field: currField, // 没有该字段时 ，拼接唯一字段
  //       childFlag: false
  //     }
  //     dynamicData[currField] = child.name

  //     // 年 选项处理为 三级标题 
  //     if(item.data.isGroupbyYear == 1){
  //       if(item.yearVals && item.yearVals.length>0){
  //         obj.childFlag = true
  //         obj.children = dealYear(item,dynamicData)
  //       }
        
  //     }
  //     children.push(obj)
  //   })

  // } 
  return children
}

export const dealYear = (item,dynamicData)=>{
  let arr = []
  // if(item.yearVals && item.yearVals.length>0){
    //有选中的年份
    for(let i=0; i<item.yearVals.length; i++){
      const currYear = item.yearVals[i]
      arr.push({
        id: currYear, 
        label: `${currYear}年`, 
        Field: currYear, 
        childFlag: false
      })
      dynamicData[currYear] = `${currYear}年`
    }
  // } 
  // else{
  //   // 默认显示近五年
  //   const currYear = new Date().getFullYear()
  //   for(let i=0; i<5; i++){
  //     arr.push({
  //       id: currYear-i, 
  //       label: `${currYear-i}年`, 
  //       Field: currYear-i, 
  //       childFlag: false
  //     })
  //     dynamicData[currYear-i] = `${currYear-i}年`
  //   }
  // }
  return arr
}

// 默认列的子选项sselect中补选中，但是在列表中全展示
export const dealSecondColumnDataOld = (item,dynamicData) =>{
  let children = []
  if(item.optionsVals && item.optionsVals.length>0) {
    // 有选中的项目            
    item.optionsVals.forEach((val,ind2)=>{
      const child = item.options.find((ele) => ele.name == val);          
      const currField = item.data.nameLocal + child.code 
      let obj = {
        label: child.name,
        id: item.id || "",
        // id: currField,
        Field: currField, // 没有该字段时 ，拼接唯一字段
        childFlag: false
      }
      dynamicData[currField] = child.name

      // 年 选项处理为 三级标题
      if(item.data.isGroupbyYear == 1){
        obj.childFlag = true
        obj.children = dealYear(item,dynamicData)         
      }
      children.push(obj)
    })
    // childObj.children = children
  } else{
    // 默认全部展示             
    item.options.forEach((child,ind2)=>{      
      const currField = item.data.nameLocal + child.code
      let obj = {
        label: child.name,
        id: item.id || "",
        // id: currField,
        Field: currField, // 没有该字段时 ，拼接唯一字段
        childFlag: false
      }
      dynamicData[currField] = child.name

      // 年 选项处理为 三级标题 
      if(item.data.isGroupbyYear == 1){     
        obj.childFlag = true
        obj.children = dealYear(item,dynamicData)
      }
      children.push(obj)
    })
    // childObj.children = children
  } 
  return children
}

export const column3 = [
  { id: 1, label: `部门`, Field:'unitName', childFlag: false},
  { id: 2, label: `职称`, Field:'professionalLevel', childFlag: true , 
    children:[
      {
        id: 2001, label: `正高级`, Field:'seniorTitle', childFlag: false 
      }, 
      {
        id: 2002, label: `副高级`, Field:'associateTitle', childFlag: false 
      }, 
      {
        id: 2003, label: `中级`, Field:'intermediateTitle', childFlag: false 
      }, 
      {
        id: 2004, label: `初级`, Field:'juniorTitle', childFlag: false 
      }
    ]
  }
];

export const demoOptions = [
  {
    value: 'guide',
    label: 'Guide',
    children: [
      {
        value: 'disciplines',
        label: 'Disciplines',
        children: [
          {
            value: 'consistency',
            label: 'Consistency',
          },
          {
            value: 'feedback',
            label: 'Feedback',
          },
          {
            value: 'efficiency',
            label: 'Efficiency',
          },
          {
            value: 'controllability',
            label: 'Controllability',
          },
        ],
      },
      {
        value: 'navigation',
        label: 'Navigation',
        children: [
          {
            value: 'side nav',
            label: 'Side Navigation',
          },
          {
            value: 'top nav',
            label: 'Top Navigation',
          },
        ],
      },
    ],
  },
  {
    value: 'component',
    label: 'Component',
    children: [
      {
        value: 'basic',
        label: 'Basic',
        children: [
          {
            value: 'layout',
            label: 'Layout',
          },
          {
            value: 'color',
            label: 'Color',
          },
          {
            value: 'typography',
            label: 'Typography',
          },
          {
            value: 'icon',
            label: 'Icon',
          },
          {
            value: 'button',
            label: 'Button',
          },
        ],
      },
      {
        value: 'form',
        label: 'Form',
        children: [
          {
            value: 'radio',
            label: 'Radio',
          },
          {
            value: 'checkbox',
            label: 'Checkbox',
          },
          {
            value: 'input',
            label: 'Input',
          },
          {
            value: 'input-number',
            label: 'InputNumber',
          },
          {
            value: 'select',
            label: 'Select',
          },
          {
            value: 'cascader',
            label: 'Cascader',
          },
          {
            value: 'switch',
            label: 'Switch',
          },
          {
            value: 'slider',
            label: 'Slider',
          },
          {
            value: 'time-picker',
            label: 'TimePicker',
          },
          {
            value: 'date-picker',
            label: 'DatePicker',
          },
          {
            value: 'datetime-picker',
            label: 'DateTimePicker',
          },
          {
            value: 'upload',
            label: 'Upload',
          },
          {
            value: 'rate',
            label: 'Rate',
          },
          {
            value: 'form',
            label: 'Form',
          },
        ],
      },
      {
        value: 'data',
        label: 'Data',
        children: [
          {
            value: 'table',
            label: 'Table',
          },
          {
            value: 'tag',
            label: 'Tag',
          },
          {
            value: 'progress',
            label: 'Progress',
          },
          {
            value: 'tree',
            label: 'Tree',
          },
          {
            value: 'pagination',
            label: 'Pagination',
          },
          {
            value: 'badge',
            label: 'Badge',
          },
        ],
      },
      {
        value: 'notice',
        label: 'Notice',
        children: [
          {
            value: 'alert',
            label: 'Alert',
          },
          {
            value: 'loading',
            label: 'Loading',
          },
          {
            value: 'message',
            label: 'Message',
          },
          {
            value: 'message-box',
            label: 'MessageBox',
          },
          {
            value: 'notification',
            label: 'Notification',
          },
        ],
      },
      {
        value: 'navigation',
        label: 'Navigation',
        children: [
          {
            value: 'menu',
            label: 'Menu',
          },
          {
            value: 'tabs',
            label: 'Tabs',
          },
          {
            value: 'breadcrumb',
            label: 'Breadcrumb',
          },
          {
            value: 'dropdown',
            label: 'Dropdown',
          },
          {
            value: 'steps',
            label: 'Steps',
          },
        ],
      },
      {
        value: 'others',
        label: 'Others',
        children: [
          {
            value: 'dialog',
            label: 'Dialog',
          },
          {
            value: 'tooltip',
            label: 'Tooltip',
          },
          {
            value: 'popover',
            label: 'Popover',
          },
          {
            value: 'card',
            label: 'Card',
          },
          {
            value: 'carousel',
            label: 'Carousel',
          },
          {
            value: 'collapse',
            label: 'Collapse',
          },
        ],
      },
    ],
  },
  {
    value: 'resource',
    label: 'Resource',
    children: [
      {
        value: 'axure',
        label: 'Axure Components',
      },
      {
        value: 'sketch',
        label: 'Sketch Templates',
      },
      {
        value: 'docs',
        label: 'Design Documentation',
      },
    ],
  },
]
